package com.sneakxy.cloudbase.platform.repository;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.sneakxy.cloudbase.platform.bean.Account;

/**
 * 
 * @author 潜行的青衣
 * @see
 */
@Repository
public interface AccountRepository extends BaseRepository<Account, String> {

	@Select({
		"select t0.* from t_mb4j_account t0 ",
		"join t_mb4j_account_role t1 on t0.id=t1.account_id ",
		"where (t0.account like #{search} or t0.memo like #{search}) ",
		"and t1.role_id=#{roleId} "
	})
	@ResultMap("Account")
	public Page<Account> findByRoleId(@Param("roleId") String roleId, @Param("search") String search, Pageable pageable);
	
}
